<template>
  <div class="app-container">
    <el-form :inline="true" label-width="80px">
      <el-form-item label="产品编号">
        <el-input
          v-model.trim="queryParams.productNum"
          placeholder="请输入产品编号"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="产品名称">
        <el-input
          v-model="queryParams.productName"
          placeholder="请输入产品名称"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="条形码">
        <el-input
          v-model="queryParams.barCode"
          placeholder="请输入条形码"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>


      <el-form-item>
        <el-button
          class="filter-item"
          type="primary"
          icon="el-icon-search"
          size="mini"
          @click="handleQuery"
          v-hasPermi="['purchase:provider:query']"
        >搜索
        </el-button>
        <el-button
          class="filter-item"
          type="primary"
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['purchase:provider:add']"
        >新增
        </el-button>
      </el-form-item>
    </el-form>


    <!--件号数据表-->
    <el-table
      v-loading="loading"
      :data="productNumList"
    >
      <el-table-column align="center" label="序号" width="50">
        <template slot-scope="scope">
          {{scope.$index+1}}
        </template>
      </el-table-column>
      <el-table-column label="产品编号" align="center" prop="productNum" sortable="custom" width="150px"/>
      <el-table-column label="产品名称" align="center" prop="productName"/>
      <el-table-column label="供应商类型" align="center" prop="providerType"/>
      <el-table-column label="有效期" align="center" prop="validDate">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.validDate, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="审批状态" align="center" prop="status" :formatter="providerStatusFormat" width="100"/>
      <el-table-column label="合格" align="center" prop="passStatus" :formatter="providerPassStatusFormat"/>
      <el-table-column label="操作人" align="center" prop="optByName" width="100"/>
      <el-table-column label="操作时间" align="center" prop="optDate">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.optDate,'{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="250px">
        <template slot-scope="scope">
          <el-button
            v-if="scope.row.status == '0'"
            size="mini"
            type="text"
            icon="el-icon-circle-check"
            @click="handleSubmit(scope.row)"
            v-hasPermi="['purchase:provider:submit']"
          >提交
          </el-button>
          <el-button
            v-if="scope.row.status !== '0'"
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['purchase:provider:view']"
          >查看
          </el-button>
          <el-button
            v-if="scope.row.status == '0'"
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['purchase:provider:update']"
          >修改
          </el-button>
          <el-button
            v-if="scope.row.status == '0'"
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['purchase:provider:delete']"
          >删除
          </el-button>
        </template>
      </el-table-column>
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />




  </div>

</template>

<script>
  export default {
    name: "productNum",
    data() {
      return {
        loading:false,
        total:0,

        queryParams: {
          productNum: undefined,
          productName: undefined,
          barCode: undefined,
          pageNum: 1,
          pageSize: 10
        },

        /*件号数据表格*/
        productNumList:[]
      }
    },

    methods: {
      handleQuery() {

      },

      handleAdd(){
        this.$router.push({name:'addProductNum'})
      }
    }
  }
</script>

<style scoped>

</style>
